#
# Copyright Laureano Arcanio 2008
# Released under the MIT License
# laureano.arcanio@gmail.com
#

from unittest import TestCase

from lymon.core import Document
from lymon.view import Selector



# Tests the Selector class.
class Selector_Test(TestCase):
	"""
	Test Selector module
	"""
	def runTest(self):
		# preparing the document
		html = Document()
		html.div(slot='a', attrs={'id': 'mainTag'})
		html.div(slot='a.b', attrs={'class': 'classB'})
		html.div(slot='a.c')
		html.h6(slot='a.b.c', attrs={'id': 'title'})
		# Tag to Match 
		tag = html.context[-1]
		s = Selector(tag=tag, context=html.context)
		# Matched to compare
		matched = s.build()
		
		compare = 'div#mainTag div#b h6#title '
		# Test
		self.assertEqual(matched, compare, "There is a problem matching tags !")
